version 8.2
capture clear
capture log close
set more off
set mem 5000m
set mat 2000

set scheme s2mono

use "Enterprise surveys_judicial_reforms_standardized dataset.dta", replace

****for the graph, we need to keep the data that we are working on: ie: dataset==1
keep if dataset==1
sum h7a

collapse (mean) mean_h7a=h7a, by(reform_dum1 post DJ4g1m)

graph twoway (scatter mean_h7a post if reform_dum1==1 & DJ4g1m==0, connect(direct) lcolor(black) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
(scatter mean_h7a post if reform_dum1==0 & DJ4g1m==0, connect(direct) lcolor(black) lpattern(dash) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
,  legend(order(1 2) label(1 "Judicial Reform") label(2 "No Judicial Reform")) xtitle("") xscale(range(-0.2 1.2)) xlabel(0(1)1 0 "Baseline" 1 "Endline") ytitle("") title("")
graph export "Figure 2b graph_h7a_DJ4g1m=0.png", replace

graph twoway (scatter mean_h7a post if reform_dum1==1 & DJ4g1m==1, connect(direct) lcolor(black) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
(scatter mean_h7a post if reform_dum1==0 & DJ4g1m==1, connect(direct) lcolor(black) lpattern(dash) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
,  legend(order(1 2) label(1 "Judicial Reform") label(2 "No Judicial Reform")) xtitle("") xscale(range(-0.2 1.2)) xlabel(0(1)1 0 "Baseline" 1 "Endline") ytitle("") title("")
graph export "Figure 2a graph_h7a_DJ4g1m=1.png", replace

clear
 
use "Enterprise surveys_judicial_reforms_standardized dataset.dta", replace

****for the graph, we need to keep the data that we are working on: ie: dataset==1
keep if dataset==1

replace va_perwo_ppp_trim1=va_perwo_ppp_trim1/1000
sum va_perwo_ppp_trim1

collapse (mean) mean_va_perwo_ppp_trim1=va_perwo_ppp_trim1, by(reform_dum1 post DJ4g1m)

graph twoway (scatter mean_va_perwo_ppp_trim1 post if reform_dum1==1 & DJ4g1m==0, connect(direct) lcolor(black) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
(scatter mean_va_perwo_ppp_trim1 post if reform_dum1==0 & DJ4g1m==0, connect(direct) lcolor(black) lpattern(dash) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
,  legend(order(1 2) label(1 "Judicial Reform") label(2 "No Judicial Reform")) xtitle("") xscale(range(-0.2 1.2)) xlabel(0(1)1 0 "Baseline" 1 "Endline") ytitle("In ,000 USD PPP") title("Value added per worker in GENERIC sectors")
graph export "Figure 2d graph_va_perwo_ppp_trim1_DJ4g1m=0.png", replace

graph twoway (scatter mean_va_perwo_ppp_trim1 post if reform_dum1==1 & DJ4g1m==1, connect(direct) lcolor(black) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
(scatter mean_va_perwo_ppp_trim1 post if reform_dum1==0 & DJ4g1m==1, connect(direct) lcolor(black) lpattern(dash) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
,  legend(order(1 2) label(1 "Judicial Reform") label(2 "No Judicial Reform")) xtitle("") xscale(range(-0.2 1.2)) xlabel(0(1)1 0 "Baseline" 1 "Endline") ytitle("In ,000 USD PPP") title("Value added per worker in SPECIFIC sectors")
graph export "Figure 2c graph_va_perwo_ppp_trim1_DJ4g1m=1.png", replace


clear
 
use "Enterprise surveys_judicial_reforms_standardized dataset_with pre data.dta", replace

****for the graph, we need to keep the data that we are working on: ie: dataset==1
keep if dataset==1

gen time=0 if pre==1
replace time=1 if pre==0&post==0
replace time=2 if post==1



collapse (mean) mean_va_perwo_ppp_trim1=va_perwo_ppp_trim1, by(reform_dum1 time DJ4g1m)


graph twoway (scatter mean_va_perwo_ppp_trim1 time if reform_dum1==1 & DJ4g1m==1, connect(direct) lcolor(black) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
(scatter mean_va_perwo_ppp_trim1 time if reform_dum1==0 & DJ4g1m==1, connect(direct) lcolor(black) lpattern(dash) lwidth(thick) msymbol(O) mcolor(black) msize(large)) ///
,  legend(order(1 2) label(1 "Judicial Reform") label(2 "No Judicial Reform")) xtitle("") xscale(range(-0.2 2.2)) xlabel(0(1)2 0 "Pre" 1 "Baseline" 2 "Endline") ytitle("In ,000 USD PPP") title("Value added per worker in SPECIFIC sectors")
graph export "Figure 2e graph_va_perwo_ppp_trim1_DJ4g1m=1_pre trends.png", replace



exit


